<template>
  <div>
    <GTable ref="table" api="/v1/edilog/selectEdiLogList" :columnSource="baseColumns" :hasEdit="true" :cbFun="cbFun" :otherHeight="-36" @setdialog="setdialog" />

    <el-dialog :title="dialogModule.title" :visible.sync="dialogModule.flag" center v-dialogDrag width="720px">
      <div v-tit="'日志报文信息'">
        <GForm ref="detail" :config="formConfig" disabled v-model="form"></GForm>
      </div>
      <span slot="footer">
        <el-button type="primary" @click="dialogModule.flag = false">确定</el-button>
        <el-button @click="dialogModule.flag = false">取消</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
export default {
  name: 'log',
  data() {
    return {
      tableSelectData: [],
      dialogModule: {
        loading: false,
        flag: false,
        title: '',
        data: null,
        type: ''
      },
      form: {
        logno:null,
        request:null,
        response:null,
        apicontext:null,
        errorexception:null,
        whseidrulepre:null,
        whseidruleafter	:null,
        executerloadvalidatepre :null,
        executerloadvalidateafter	:null,
        buildapiglobalmappre:null,
        buildapiglobalmapafter	:null,
        buildtablevalueaftermain:null,
        buildtablevalueaftersub:null,
        executerpresavecustompre:null,
        executerpresavecustomafter	:null,
        determinewhseidsaveorupdatepre:null,
        determinewhseidsaveorupdatequerymainexistssql:null,
        determinewhseidsaveorupdatequerycomparethresholdsql:null,
        determinewhseidsaveorupdateafter:null
      }
    }
  },
  computed: {
    baseColumns() {
      return [
        {
          label: '日志流水号',
          prop: 'logno',
          input: 'input'
        },
        {
          label: 'api名称',
          prop: 'ediapiname',
          input: 'input'
        },
        {
          label: '日志关键字段',
          prop: 'logkey',
          input: 'input'
        },
        {
          label: '状态信息',
          prop: 'status',
          input: 'input',
        },
        {
          label: '请求开始时间',
          prop: 'starttime',
          input: 'input'
        },
        {
          label: '请求结束时间',
          prop: 'endtime',
          input: 'input'
        }
      ]
    },
    formConfig() {
      return [
        {
          prop: 'logno',
          type: 'input',
          label: 'log编号'
        },
        {
          prop: 'request',
          type: 'textarea',
          label: '请求报文'
        },
        {
          prop: 'response',
          type: 'textarea',
          label: '响应报文'
        },
        {
          prop: 'apicontext',
          type: 'textarea',
          label: '配置信息上下文'
        },
        {
          prop: 'errorexception',
          type: 'textarea',
          label: '错误异常信息'
        },
        {
          prop: 'whseidrulepre',
          type: 'textarea',
          label: '执行确定仓库号前'
        },
        {
          prop: 'whseidruleafter',
          type: 'textarea',
          label: '执行确定仓库号后'
        },
        {
          prop: 'executerloadvalidatepre',
          type: 'textarea',
          label: '执行自定义校验逻辑前 '
        },
        {
          prop: 'executerloadvalidateafter',
          type: 'textarea',
          label: '自定义校验逻辑后'
        },
        {
          prop: 'buildapiglobalmappre',
          type: 'textarea',
          label: '执行流水号规则前'
        },
        {
          prop: 'buildapiglobalmapafter',
          type: 'textarea',
          label: '执行流水号规则后'
        },
        {
          prop: 'buildtablevalueaftermain',
          type: 'textarea',
          label: '执行表填充后主表数据对象'
        },
        {
          prop: 'buildtablevalueaftersub',
          type: 'textarea',
          label: '执行表填充后从表数据填充对象'
        },
        {
          prop: 'executerpresavecustompre',
          type: 'textarea',
          label: '执行保存前自定义逻辑'
        },
        {
          prop: 'executerpresavecustomafter',
          type: 'textarea',
          label: '执行保存前自定义逻辑'
        },
        {
          prop: 'determinewhseidsaveorupdatepre',
          type: 'textarea',
          label: '决定表头是插入还是更新前'
        },
        {
          prop: 'determinewhseidsaveorupdatequerymainexistssql',
          type: 'textarea',
          label: '决定是否更新拼接sql'
        },
        {
          prop: 'determinewhseidsaveorupdatequerymainexistssql',
          type: 'textarea',
          label: '决定是否更新拼接sql'
        },
        {
          prop: 'determinewhseidsaveorupdatequerycomparethresholdsql',
          type: 'textarea',
          label: '存在数据决定是否更新拼接sql'
        },
        {
          prop: 'determinewhseidsaveorupdateafter',
          type: 'textarea',
          label: '决定表头是插入还是更新后'
        }
      ]
    }
  },
  methods: {
    getInfoById(logno) {
      this.$post('/v1/edilog/selectEdiContentLogByLogno', {
        logno
      }).then(res => {
        this.form = res.data.item
        this.dialogModule.flag = true
      })
    },
    setdialog(data) {
      this.form.logno=''
      this.form.request=''
      this.form.response=''
      this.form.apicontext=''
      this.form.errorexception=''
      this.form.whseidrulepre=''
      this.form.whseidruleafter	=''
      this.form.executerloadvalidatepre =''
      this.form.executerloadvalidateafter	=''
      this.form.buildapiglobalmappre=''
      this.form.buildapiglobalmapafter	=''
      this.form.buildtablevalueaftermain=''
      this.form.buildtablevalueaftersub=''
      this.form.executerpresavecustompre=''
      this.form.executerpresavecustomafter	=''
      this.form.determinewhseidsaveorupdatepre=''
      this.form.determinewhseidsaveorupdatequerymainexistssql=''
      this.form.determinewhseidsaveorupdatequerycomparethresholdsql=''
      this.form.determinewhseidsaveorupdateafter=''
      this.dialogModule.title = `日志报文信息`
      this.dialogModule.data = data;
      this.form.logno=null
      this.getInfoById(data.logno)
    },

    cbFun(res) {
      return { list: res.data.page.records, total: res.data.page.total }
    },
    async getTableData() {
      this.$refs.table.getTableData()
    }
  }
}
</script>

<style scoped>
</style>
